package loja.controller.seguranca;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

@ManagedBean(name = "isUser")
@RequestScoped
public class IsUserRSBean {

	public boolean inRole(String rule) {
		FacesContext context = FacesContext.getCurrentInstance();
		return context.getExternalContext().isUserInRole(rule);
	}

	public String getUserName() {
		FacesContext context = FacesContext.getCurrentInstance();
		return context.getExternalContext().getUserPrincipal().getName();
	}
}
